﻿using LiteStep.Currencies;
using LiteStep.Utils;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LiteStep.Exchanges.BtcE
{
	public class Ticker<TFrom, TTo> : ITicker
		where TFrom : ICurrency
		where TTo : ICurrency
	{
		[JsonProperty(PropertyName = "high")]
		public double High { get; set; }
		[JsonProperty(PropertyName = "low")]
		public double Low { get; set; }
		[JsonProperty(PropertyName = "avg")]
		public double Average { get; set; }
		[JsonProperty(PropertyName = "vol")]
		public double Volume { get; set; }
		[JsonProperty(PropertyName = "vol_cur")]
		public double CurrentVolume { get; set; }
		[JsonProperty(PropertyName = "last")]
		public double Last { get; set; }
		[JsonProperty(PropertyName = "buy")]
		public double Buy { get; set; }
		[JsonProperty(PropertyName = "sell")]
		public double Sell { get; set; }
		[JsonProperty(PropertyName = "server_time")]
		[JsonConverter(typeof(UnixDateTimeConverter))]
		public DateTime Timestamp { get; set; }

		public override string ToString()
		{
			return string.Format("Last: {0}, High: {1}, Low: {2}, Volume: {3}, Average: {4}", Last, High, Low, Volume, Average);
		}
	}
}
